package cn.yunyichina.provider.sys.service.impl;

import cn.yunyichina.provider.iface.entity.common.Response;
import cn.yunyichina.provider.sys.dao.DeptDao;
import cn.yunyichina.provider.sys.entity.Dept;
import cn.yunyichina.utils.convert.JsonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/2/24.
 */
@Service
public class DeptServiceImpl {
    private static Logger logger = LoggerFactory.getLogger(DeptServiceImpl.class);

    @Autowired
    private DeptDao deptDao;

    /**
     * 获取部门列表 yyt.sys.dept.list
     * @param data
     * @return
     */
    public Response listDept(String data){
        logger.info("listDept原始入参data={}",data);
        Response response = new Response();
        Dept wheres = JsonUtils.parseObject(data,Dept.class);
        wheres.setEnableFlag(new Short("1"));

        List<Dept> deptList = deptDao.select(wheres);
        response.setResultCodeAndMessageAndResult("0","成功",JsonUtils.toJsonString(deptList));
        logger.info("listDept出参response={}",JsonUtils.toJsonString(response));

        return response;
    }
}
